<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./jq-3.6.0.js"></script>
</head>

<body>
    <div class="box">
        <div class="item">0</div>
        <div class="item">1</div>
        <div class="item2 red">2</div>
        <div class="item">3</div>
        <div class="item">4</div>
        <div class="item5">
            5
            <div class="item5"></div>
            <div class="item5"></div>
        </div>
    </div>
</body>
<script>
    //获取父亲jquery对象
    var parent = $('.item').parent();
    console.log(parent);
    //获取孩子jquery对象
    var items = $('.box').children('.item');
    console.log(items);
    //children只能孩子jq元素数组对象不能获取孙子的
    var item5s = $('.box').children('.item5');
    console.log(item5s);
    //find 能够获取全部的(后代)
    var item5s = $('.box').find('.item5');
    console.log(item5s);
    //siblings获取兄弟节点除了自己()可以加选择器筛选
    var xiongdi = $(".item2").siblings(".item");
    console.log(xiongdi);
    var next = $(".item2").nextAll(".item");
    console.log(next);
    console.log($(".item2").hasClass('red1'));
</script>

</html>